
a = int(input())
if  a > 10000 or a < 1000:
    print('0')
    
    






else:
    k = 0
    z = a % 1000
    b = a //10
    l = (a % 100 // 10) * 10 
    v = a % 10
    for i in range(2, z):
        if  z % i == 0:
            k += 1
        if k == 0:
            print('wfwf')
        else:
            print(a)
    for i in range(2, b):
        if  b % i == 0:
            k += 1
        if k == 0:
            print(a)
        else:
            k += 1
    print(k)
            
        
            
